<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%  String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()
                               +":"+request.getServerPort()+path+"/";
%>

<html>
  <head>
    <base href="<%=basePath%>">
    <title>用户CRUD</title>
  </head>
  
  <body>
	<center>
    <h1>用户列表</h1>
    <table border="1">
    	<tr>
    		<th>ID</th>
    		<th>用户名</th>
    		<th>操作</th>
    	</tr>
    	<s:iterator value="#userlist" var="user">
    		<tr>
    			<form action="action" method="post">
    				<td><input type="text" name="id" value="<s:property value='#user.id'/>" readonly="readonly"></td>
	    			<td><input type="text" name="name" value="<s:property value='#user.name'/>"></td>
	    			<td>
	    				<input type="button" value="删除用户"
	    					onclick="javascript:this.form.action='userdeleteAction';this.form.submit()">
	    				<input type="button" value="修改用户"
	    				    onclick="javascript:this.form.action='userupdateAction';this.form.submit()">
	    			</td>
    			</form>
    		</tr>
    	</s:iterator>
    </table><br><hr>
    
    <h1>添加用户</h1>
    <form action="useraddAction" method="post">
                  用户名:<input type="text" name="name">
         <input type="submit" value="提交"/>
    </form><br>
    
    </center>
  </body>
</html>
